Skip to main content

Authentication

To authenticate with the Velolink API, you'll need to include your API token in the request headers using the X-ApiToken header.

API Endpoint

The Velolink API endpoint:

https://api.velolink.cloud/graphql

Example Request

Example using curl to query the latest vehicle positions:

curl https://api.velolink.cloud/graphql \
-H "X-ApiToken: df5980282e71951ff20d32775f98f61cae576f35774106f901385cc8fc24d705c769ede1344ae95efb0661ece511eb0c660bf72434de463bbca7db4361a33024" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"query": "query latest { latest(namespace: \"mynamespace\") { vehicleId namespace operator routeId tripId featureData features lat long timestamp } }"
}'

Example Response

The API will respond with a JSON object containing the requested data:

{
"data": {
"latest": [
"133": {
"vehicleId": "133",
"namespace": "mynamespace",
"operator": "SC",
"routeId": "60",
"tripId": "3718018",
"features": [
"cyclist",
"priority"
],
"featureData": {
"cyclist": {
"deployed": true,
"capacity": 3,
"available": 2,
"used": 1,
"type": "cyclist",
"rideStart": true,
"rideEnd": false
},
"priority": {
"capacity": 2,
"available": 1,
"used": 1,
"type": "priority",
"rideStart": true,
"rideEnd": false
}
},
"lat": 37.36457443237305,
"long": -121.92312622070312,
"timestamp": "2025-04-15T22:16:17.866Z",
"events": []
},
"135": {
"vehicleId": "135",
"namespace": "mynamespace",
"operator": "SC",
"routeId": "60",
"tripId": "3717954",
"features": [
"cyclist",
"priority"
],
"featureData": {
"cyclist": {
"deployed": false,
"capacity": 3,
"available": 3,
"used": 0,
"type": "cyclist",
"rideStart": false,
"rideEnd": false
},
"priority": {
"capacity": 2,
"available": 2,
"used": 0,
"type": "priority",
"rideStart": false,
"rideEnd": false
}
},
"lat": 37.373416900634766,
"long": -121.91786193847656,
"timestamp": "2025-04-15T22:31:17.805Z",
"events": []
}
]
}
}

Notes

note
  • Replace the example API token with your own token obtained from the console
  • The response includes an array of the latest positions for all vehicles in the specified namespace
  • Timestamps are provided in ISO 8601 format with UTC timezone
  • The featureData object contains additional vehicle telemetry data
  • The features array indicates which data points are available for each vehicle

Error Handling

If authentication fails, you'll receive a 401 Unauthorized response. Example:

{
"errors": [
{
"message": "UNAUTHORIZED"
}
]
}
warning

Make sure to keep your API token secure and never share it in public repositories or documentation.